<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <ul class="list">
        <li>6000</li>
        <li>4000</li>
        <li>3000</li>
        <li>1000</li>
    </ul>
    <ul class="list">
        <li>南山</li>
        <li>福田</li>
        <li>宝安</li>
        <li>罗湖</li>
    </ul>
    <ul class="list">
        <li>三房一厅</li>
        <li>二房一厅</li>
        <li>一房一厅</li>
        <li>一房</li>
    </ul>
    <h2>选出来的条件是：</h2>
    <ul class="search">

    </ul>

    <script>
        // 获取元素
        let aUl = $("ul");
        let aSearch = $(".search")[0];
        for (let i = 0; i < aUl.length; i++) {
            add_search(aUl[i]);
        }

        function add_search(obj) {
            let oLi = obj.querySelectorAll("li");
            let NewLi = null;

            for (let i = 0; i < oLi.length; i++) {
                oLi[i].addEventListener('click', function() {
                    if (!NewLi) {
                        NewLi = this.cloneNode("true");
                        aSearch.appendChild(NewLi);
                    } else {
                        NewLi.innerHTML = this.innerHTML;
                    }
                })
            }
        }

        function addEventListener(element, eventName, fn) {
            if (element.addEventListener) {
                element.addEventListener(eventName, fn);
            } else if (element.attachEvent) {
                element.attachEvent("on" + eventName, fn);
            } else {
                // 相当于element.onclick = fn;
                element['on' + eventName] = f(n);
            }
        }

        function $(select) {
            return document.querySelectorAll(select);
        }
    </script>
</body>

</html>